package com.befirefly.studentmanager.service.impl;

import com.befirefly.studentmanager.entity.AdminDo;
import com.befirefly.studentmanager.mapper.AdminMapper;
import com.befirefly.studentmanager.service.AdminService;
import org.apache.commons.lang3.StringUtils;

/**
 * @Author: 八千里路云和月
 * @Date: 2021/2/7 22:49
 * @Description:
 */
public class AdminServiceImpl implements AdminService {

    @Override
    public boolean validateAdmin(AdminDo adminDo) {
        String username = adminDo.getUsername();
        String pwdParam = adminDo.getPwd();
        if (StringUtils.isBlank(username) || StringUtils.isBlank(pwdParam)) {
            return false;
        }
        String password = AdminMapper.selectPasswordByUsername(username);
        if (StringUtils.equals(pwdParam, password)) {
            return true;
        }
        return false;
    }
}
